package algortims;

import implementation.HostImpl;

import java.util.List;

public class SortedMachine extends Thread {

	public boolean running;
	public List<Integer> data;

	public SortedMachine() {
		this.running = false;
	}

	public SortedMachine(String head, List<Integer> data) {
		this.data = data;
	}

	public void run() {
		running = true;
		// Collections.sort(data);

		try {

			for (Integer number : data) {
				try {
					if (number != null)
						//System.out.println(number);
						HostImpl.numbers.offer(number);
				} catch (Exception e) {
					e.printStackTrace();

				}

			}
		} catch (Exception e) {
			
			//e.printStackTrace();
		}
		
		 /*try{ synchronized (HostImpl.numbers) { 
			 
			 HostImpl.numbers.addAll(data);
		 }
		 
		 
		  }catch(Exception e) { e.printStackTrace(); }
		 
		  */
		running = false;

	}

}
